partial  bug fixing