Fixed bug where pass 2 would be done twice