change empty error to raise and rescue