Fixed null cursor bug