Bug fixes

#9 and #8