fixed a few potential bugs, a new bug with adding a double appeared