fixed bug causeing excess insertions