check on result array wasn't right. now checks length and works