fixed routes
db fixes, error handling, added constraints