improved macros for type safty, for all classes