Fixed undefined q bug.