Bug fix with cleanup.