Making multi-domain function work in Fit