add JSON parsing and remove undefined argument in callback