Fix tests for issues #30 and #31