   Please note that all the modules defined in the same file as `module`
   are recompiled and reloaded.
   """
-  def r(module) do
+  def r(module) when is_atom(module) do
     case do_r(module) do
       mods when is_list(mods) -> { module, mods }
       other -> other

  @doc """
  Changes the current working directory to the given path.
  """
  def cd(directory) do
    case File.cd(expand_home(directory)) do
      :ok -> pwd
      { :error, :enoent } ->

  Produces a simple list of a directory's contents.
  If `path` points to a file, prints its full path.
  """
  def ls(path // ".") when is_binary(path) do
    path = expand_home(path)
    case File.ls(path) do
      { :ok, items } ->
