Null pointer exception in getHeaderBlocks