Implement #505.