fix some problems and adding some tests