A good PLC program needs to be carefully checked, by walking every subroutine and every goto, to make sure when PLC logic reach to END or START again, it popped all the stack, i.e., if you called how many CALLSUB, you also called so many RET. For everywhere logic branches and goto to another place, all those logic need to be checked.