optimization

I was seeing getUnit() show up when I did some profiling.  I added a little fix that should make it a bit faster.  Take a look and merge if you think it's OK.  Thanks.