scope problems fixed