Solved problem with exceptions