Fixed autoloading and query, inserted some tests in plugin main file