More bug fixes from replace all