added test and fix