codgen fixes for vars, by way of @TCKnet