Merge "Prevent NullPointerException and remove unsed variable"