fixed pixel apply and training to persist nulls and undefined values