fix objToAttributes so that "null" is not inserted into attributes string