loudness detector: more error checking