diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js
index 25da2bc6835320bc03e7ade1af34dc9bc6a35834..6e45547ebb4bdb3bd81e4b206cfa36b7c6c1ca40 100644
--- a/apps/files_imageviewer/js/lightbox.js
+++ b/apps/files_imageviewer/js/lightbox.js
@@ -36,7 +36,7 @@ function showLightbox(container,img){
 			img.width = maxHeight * ratio;
 		} else {
 			img.width = maxWidth;
-			img.height = maxWidth * ratio;
+			img.height = maxWidth / ratio;
 		}
 	}
 	container.empty();
@@ -55,4 +55,4 @@ function hideLightbox(){
 		$('#lightbox').hide();
 		lightBoxShown=false;
 	}
-}
\ No newline at end of file
+}
diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php
index aa1de65c084eb296a1f439cc9b298d870df99946..e83cf6861bfe95537e3dbb2ca9d273d59e4db48d 100644
--- a/core/templates/layout.admin.php
+++ b/core/templates/layout.admin.php
@@ -23,7 +23,6 @@
 				echo $header['text'];
 				echo '</'.$header['tag'].'>';
 			?>
-			<script type="text/javascript" src="<?php echo $jsfile; ?>"></script>
 		<?php endforeach; ?>
 	</head>
 
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index dedb6e2e4a1b4633c04965055a53715ffe2eac5d..ffdb7937ae731ad629903964c73a71d17bebd057 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -23,7 +23,6 @@
 				echo $header['text'];
 				echo '</'.$header['tag'].'>';
 			?>
-			<script type="text/javascript" src="<?php echo $jsfile; ?>"></script>
 		<?php endforeach; ?>
 	</head>