Reversed order of checking outputs and inputs and then fixed the issue of pointing to non-existent UTXO