replace $q with Q