Fix bad reference, and some other minor things