add logging
port to windows; fix memory comparing