Fixes bugs in p43 and optimizes p39.