fix key length checking

according to the kafka protocol, a length of -1 indicates null