added unit test for preloader, fixed preloader bug