fixed json formatting and sending