fix bug in #1220

@andreistefanescu please review