fixing bug in subroutine creation