Fixed off-by-one errors, numHiddenUnit issue