Debug moved to avoid type errors