Fixing some type checking stuff