Trying various solutions to 'undefined sub_no' error, not fixed  yet