Fix flag alpha and rendering order

TODO: find out why we need to multiply JPEG values by two