bug fix for IAR build and cleanup