fixed bug in shortest which caused errors in first