fixes for text handling in the typechecker