Apply fix for bitwise SQL queries (flags/status)