fixes #21, #22, and #24