Fix a bug and an exploit.