added some exceptions handling in controller