Updated with latest fix from master