Revert "Improve autoloading code"

This reverts commit 40513fa4087945a6f9bfb0fec577584bc69a6878.