Fix nil value exception