fixing possible usage of null.toString() or undefined.toString()