Compacted fix for #2930