Bug fixes within #19 and #15