Fixes an issue where NPE occurs.