Fixed a bug where the existance check would occur after insertion