fixedup a few bugs