add snake_append_body function, fix NULL pointer assignment