Fix messy variable usage in debug & remove unused global

Change-Id: I8b17239d388fec9a46f5b0551e20c83c211b93b6
Merge "Fix messy variable usage in debug & remove unused global"