fix bug with bad loading alghorithm