Fixed bug causing duplicate entries