Fixed jQuery error on size calculation