Proper fix for #504