Fix #1217 by Wadik