Fixed two null reference exceptions.