Fixed some corner bugs