Fix bug in method accessing an array
Fix issues and improve readability