bunch of bug fixes for db insertion and death calc