initial implementation of #698