Fixed bug in getDir method.

getDir could take two arguments: offset and nodir. If the offset was zero, it would return nodir. However, nodir was sometimes undefined as it was not provided. I added a check to make sure if nodir was undefined, it would be set to Dir_None before calculating the direction.