fix bug -- non-exhaustive pattern match