Fix is_new method

When insert query failed the is_new method return false instead of true