++fixes and tests