added method for encoding null, for symmetry