Fixed potential NullPointerException