fixed minor bugs with memory allocation for large problems