ENH: insert commit from Alex's PR

Closes #530.