error checking valid port