Fixed bug that would duplicate rows