Saving to database fix