Fixed the save to database problem