Revert "better version of #527"

This reverts commit d569e238fbe8ac78e891657d6f5cfe226309a03c.