fixed undefined errors