fixing error, calling Object.keys on undefined object