Fix 500 error on edit with ui