Fixes issue, where last command was retrieved using current() when top()
should have been used
Changes custom JSON Encoder to throw an exception if built-in
json_encode returns false
Fixes cross-reference