fixed fatal bug that broke the code when declaring global objects