bug fixes and bump to v.31, closes #19