added replacer for JSON.stringify (bug: circular ref problem)