Fix #510. Fix #522.