Fixed minor bug potentially causing NullPointerException.