reverting unspent function