These were both totally broken; the latter wasn't even implemented. This commit fixes/implements them and adds a simple test to exercise them.