Wrong NullPointerException fix in previous commit. New attempt.