[BUG #7453] replaced local var q with r