script fixes and expect