fixed definition of q in Appendix