Fix #1140

Asking for code review.