Patch pushed as 7f6260d9fe8ed9b87cb5c314e992afec5dd76490 with some modifications. I updated to the latest version which includes the patch you proposed upstream. Thanks.