fixed undefined on connect