Fix for regression in #331, and #347