more reliable in X script