Ablation dynamics of silicon based targets in oxygen and nitrogen atmospheres