trying to make sure loaded is not undefined