Fixed variable name and logging