add condition check macros and fix dimension index pointer initialization