Implement @rmzelle's fix instead of mine