handled exceptions carefully