Small bug fixes to close #5.