add exceptions checking