Added handling for undeclared objects in dynamic sorts (sort+obj1...) where obj1 hasn't been declared.