fix bugs and setup test environment
move JSON.parse into try/catch block
Merge pull request #1 from ssnau/master

Fix bugs and setup test environment