Add missing includes and remove unused variable.