Several fixes, closes #1, ready for 0.1.1