Add keepalive support

This adds keepalive support and caught a case where result_pdu came out nil