modified version to 0.5 from pr