improved previous workaround