some fixes and added tests