small fix + unit tests

Signed-off-by: Richard Jaldin L <richard.jaldin@trueforce.com>