fixing some minor bugs to get array indexing working