Fix for #1123

How about this idea for #1123 ?
Thanks.