fix to NullPointerException and test to prove it.