Better error handling. Heroku compatible.