added stack frame macros to do some runtime checks