fixing the duplicate bug