some bug fixes in our old code