fixed nesting errors causing q to be referenced out of post