Fix controller code