bug in exception catch