improve json unmarshalling; improve debug output on panic