corrected the code for database operations using sinatra