Fix warnings and add a bit of checking to ensure we aren't wasting time updating a value if it hasn't changed.

Signed-off-by: Moose517 <moose51789@gmail.com>