some PENDING-related changes
added the check for max referenceamount