fix various things according to comments