handle unexpected value in stringify replacer function