Detecting and correcting for heteroscedasticity in the presence of measurement error