mysql filtering bug