adding runtime checks and fixing method subroutine identification