fixed loader bug, added test