fixed null pointer exception on linux/max