fixed missing arg to pieceAt
added argument typecasting for the depth args