remove useless local variable 'stat'
also remove complier warinnings