Minor refactoring and fixed a problem related to parsing null.