Fix minor method call error + Filter handling for non-arrays
Thanks to @kazu9su for providing support so that when you pass in a non-array to filter, it returns an empty array per the js version.
I also added a fix where we were calling .append on an array, which is not a method in ruby.