Fixed run time errors with the previous change