Fix alpha channel being set to NaN