bug fixes and embedding with WS potential