I think this fix is good enough for now, we can refactor later