More generic fix to #438