fixed bugs, everything works fine