added test and fixes