Fix global/local bug