add workaround for https://github.com/tessel/beta/issues/358, add some tests