fixed some bugs in the attenuation setting routine