Fixes for bugs resulting from the earlier refactoring