some real logging and corrected json output