more improvements on obs script. Fixed bug of creating keys when data does not exist.