Fix bug where profile editing could go wrong