fix I-107558

improve null/zero checking
Merge pull request #115 from topcoderinc/dan-I-107558

fix I-107558