Added 10.1 style cursor and error check