Fixes and improvements for s/ command