Fixed open cursor error