fix possible problem with cleanup