fixed controller to write from profile to db