Null handing changes and bug fix