Distorted wave calculations for multiply charged nitrogen and oxygen