fix bug of using uninitialized variables
fix missing initial value for sock_len