Fixed some bugs in 2D