now works when no global defined