Fix bug by initializing P and Q properly