replace: avoid using die() to indicate a bug