include better assertion for values going into gates. want to see if i can catch this error with the dataflow analyzer to get a better idea of what's going on.
must fix mkptr -- this is a huge source of potential errors, despite not finding them in small unit tests