Fix #1121

Not sure where should I put a test for this.