Fix bugs in discoverer module; return JSON to the client-side