fixed the lval snprintf function to include null terminated character and its tests