Fixed null pointer ref on error situations.