Fix various issues from master dev