Fix the Null Pointer problem

Signed-off-by: Ajax Chai <ajaxchai@gmail.com>