Fix NPE. Fix #185.