Fix #569 finally had some free time.