More defensive coding
Fixed CS error