fix bugs of first version