check the protocol version and import sys for messages to stderr