Fixed issues with cursor having a null id