remove unused code and fixed warning.