initial port from libdot