optimized 'invoke' function for better code coverage