Compilation fixes for sim osx

Removing an unused variable and casting another variable to an index before using it as such.