Fixed Logic

Fixed Logic