Fixed some bugs with sprite layer ordering.