fixing some bugs and mistakes in autoloader