correction to #endif and iteration