Adding some missing JSON responses and moving broadcast commands inside critical sections