fix of several reported bugs