Fixed User.update method to account for nil values in habit[:history]