when q value is invalid, set it to 0.001, when it's not defined, set it to 1