Fixed bug in single record loading, fixed toJSON