Fixed filter bug
Added tests