Bug fix

Updated Logic