Safer function chaining pattern throughout API code
Protect against crash during upgrade when no rules exist
Safer function chaining in lib/utils.js