bug fixes after restructure