fixed storin data to database