Added bug fix when type was set, but value was undefined