add type conversions and typecheck prototypes