Handle delete directory. #16

Also set keepalive for better TCP connection.
Fixed wrong if statement placement that blocked deletes.