Replaced basename() by dirname() to build file paths.

Error occured by require_once because file paths were wrong. I fixed it by using dirname() instead of basename(). Please talke a look.