fixed bug in Q_model