Fixes for q3.cpp