Fixing a couple of bugs in the angle simulation code.