refactoring loader and change unitest for new api