fixing variable declarations to avoid throwing errors in console