Thanks. I was looking in the wrong place.

I was wondering how margin could get a negative value and assumed either optimalF or capital were generating the problem.