https://jira.mongodb.org/browse/JAVA-863, fixed null checks in remove method

https://jira.mongodb.org/browse/JAVA-863, fixed null checks in remove method