Removed unreachable code
Modified to avoid throwing NPE during logging error message