fix unused vars and statements before declarations