Fix various issues