a few fixups to primitive functions