some bugs in this file, waited to be fixed