Fix save to database