Fix some issues reported by @gcmalloc

 Related to #44.