Fixed self-assignment bugs