Fixed issues #87, #86, and #85