fix nil pointer exception.