fix some problems, now working well