added some interface, fixed bugs