nil check before encode