1. handle sigpipe
2. change tab to spaces
3. fix bugs