fixed AP Gain calculation

sorry, I messed it up a bit while rewriting it to constants
issue #166