Fixed insert bug. Wasn't waiting until first transaction was finished