bugfixes in P3.c