A judge found safety improvements were not good enough before two rail workers died at Port Talbot.