Fixed Logic Error