fixed out of index errors