Fixed several bugs and added more useful debugging messages.
0.12.19