Re-applied soapdog's fix