access to empty pointer fix