Lib fixes

Just a quick fixes in the gain setting