Added check for QTDIR being set