Fixing a few bugs
Made getValue slightly safer