various fixes for gates