Fixed run time errors with the previous changes