Safer fix for Pretty module

Thanks to Xavier Leroy.