Normally the first of those errors would have stopped the program and you would not have seen the others. However, if you happen to be within the debugger, then sometimes when you dbquit it tries to run further and gives some additional errors.
For the moment, you should change your code so that you always assign a value to the output argument inside insertIntoLSB_bits, even if the value is [] or inf or nan. Like, pretty much assign to it as the first thing you do.