Fix #541 for master (2.5)