alternative fix for #48 that doesn't degrade performance