Several small fixes (#186, #120, #174)