fixed a bug on allow null detection