fixing errors and added postgres test db for travis ci