Fixed bugs in loading