Weither a server uses q or ~, it still uses the same channel mode, +q, so you just need to be looking for q and not ~(Both work though

)
The problem is the use of 'a' because with that method you used it means all users and not
ChanAdmins(SuperOps, Protected Ops, whatever you call it) this is where you should use '&'.
Hope that helps

--- Yeah I changed it, worked out my mistake ;P