Apply @bleskes patch and test fix