fixes issue but may introduce side effects