better resource load, and some fixes