FIx error in calling success function