modification and bug fixes