adding some test and fixes