fix null reconstruction bug

previously could not encode packets with null and binary mixed values. Oops stupid bug.

Added a test as well.

client and server should ideally reference this soon :)