typo in variables, moved declaration for compatibility