fixes #245
fixes #241
some performsnace updates