fixed some cases of handling null data