Fix various binding related bugs