typecheck bugfix