Revert readline optimization and add test