Fixed bug for edit and update controller