Fixed some flipping and offset issues.