'length' error is thrown in function: K flip(K a)