fixed loading logic