fix all bugs and need to test it