Fix a possible NPE

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Remove a redundant null check

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Fix an inconsistent sync

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Add a default case to a switch statement

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>