fix some issues with sprite rendering