Null reference bug fix.