Fix local? algorithm