Fix check for q value