Fix for upstream & 5.3 and added some logging