Why does my preloader freeze?

[AS]bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
this.gotoAndStop(2);
}[/AS]

What’s wrong with my code? The percent thing works but it freezes on a random number between 1 and 100 and then it never goes to frame 2.