Add value and type check for mib get/set function

Signed-off-by: leo-ma <begeekmyfriend@gmail.com>
use `x ~= nil` is a good habit.

`x ~= nil` & `x ~= 0` & `x ~= false` is different, right?