merged changes and fixed tests