changed sqlite insert commands, error logging