improved macros for type safty