Fixes suggested by cfinke