A couple bug fixes