javascript image load bugfix