Several small fixes