fix bugs, it works now