check params existance before using them

When there is no param ( especially in tests ) such as :order, disable sort_records that cause to an exception and so on.