filter can now be used as a replacement to Model#toJSON()

a tweak and a test

prevent crash on undefined val