fix P class so it can be used in maps, and stop crashing gcc