Fix error in valid_sequence?