Fixed a concurrency problem when updating values on sensor. Also added a
save persistant state routine to improve server performance.