Bug fixes.
fixed out of table index error.