cleanup lsp copy and cast