Fixed wrong variable name being used