picked last changes from official repo