added check for invalid pitch