send json
some fixes for bug