Added sanity checks to the gain settings