fixed exepction catching