Fixed bugs. Now all the examples in test/examples pass.