Fix more bugs in #45