fix P calculation (again)