new version with bug fixed