Apply SensioLabs Insights fixes to 1.x branch