Fixes : filters + magic_filter_test

Refactor magic_filter_test : reduce redundant code.
Fix sql issue on filters (ambigous conditions)