corrected errors to the previous version
introducing allocatable matrices into qpspecial