Fixed returning wrong value