[BUGFIX beta] use Object.keys when possible

I think there should be a test somehow, but I don't know how to test that