[Server] Fix filtering algorythm, some bugs