fix destructor
fix misuse of abs()