fixes global state issue