Fixed bug when handling null result.