Replace the spl_autoload with own autoload to load object with namespace.

Fix a bug in template. It now can normally run mkdir(s) without permission problem.