test and bug fixes