added type check to autoloader fixes #1504