added checks for invalid symbols