add guards around comparison