fixes based on PR 521