fixed sorting not working bug