Bug fixing

1. Fix off-by-one on getting ranges
2. Use automatically-resolved project references