Fix for #2777, #2642 : Class autoload triggers warning if class not found

Attempt to fix #2777 and #2642