fixed q and quit function