fixed exception-handling