Fix parser, rectangle bugs, history bug

Fix parser, try to fix bugs in rectangle