Fix Array out bounds in controller