fixed undefined variables