Extension to KML output format, and minor bug fix