Heroku test
Database connection update
Threading contronl via MAX_THREADS env
Fix casting error