finished fix for #493 properly this time