fix controller code