polishing and bug fixing