a few bugs to be fixed