remove unused code and fixed