Fixup ioctl to something simpler, add debugging