Fixed error where data was being written to uninitialized object.