   will raise. Returns `nil` if the application is not loaded.
   """
   @spec spec(app, key) :: value | nil
-  def spec(app, key) when key in @application_keys do
+  def spec(app, key) when is_atom(app) and key in @application_keys do
     case :application.get_key(app, key) do
       {:ok, value} -> value
       :undefined -> nil

  Returns all key-value pairs for `app`.
  """
  @spec get_all_env(app) :: [{key, value}]
  def get_all_env(app) do
    :application.get_all_env(app)
  end


  stick after the application is loaded and also on application reload.
  """
  @spec put_env(app, key, value, timeout: timeout, persistent: boolean) :: :ok
  def put_env(app, key, value, opts \\ []) when is_atom(app) do
    :application.set_env(app, key, value, opts)
  end

