fixed backwards logic