diff --git a/avatarcrop.module b/avatarcrop.module
index db52c16..dd9c5fa 100644
--- a/avatarcrop.module
+++ b/avatarcrop.module
@@ -167,25 +167,28 @@ function avatarcrop_form_submit($form, &$form_state) {
  * @return unknown
  */
 function cropUserPic() {
-	
-	$form=array();
+	$form = array();
 	$filePath = $_SESSION['filepath'];
+	$enablePicture = variable_get('user_pictures','0');
+  
+  if ($enablePicture == 0) {
+    $_SESSION['filepath'] = null;
+  }
 	
-  	$enablePicture=variable_get('user_pictures','0');
-  	
-	if($enablePicture==0) {
-		$_SESSION['filepath']=null;
-	}
+	$base = base_path();
 	
-	$base=base_path();
-	if($filePath){
+	if ($filePath) {
+	  $filePath = str_replace('//', '/', $filePath); //Fixes path problems with combining base and filepath
+	  $fileUrl = file_create_url($filePath);
+	  
 		$form['avatar_crop_title']=array(
 			'#prefix' => '<div class="avatar-crop-title">',
   			'#suffix' => '</div>',
   			'#value' => t('Make a selection on the below image to define the crop area.'),
     	);
 		$form['imageview']= array(
-			'#value' => '<img src="'. $base.$filePath.'?ts='.time().'"  id="cropbox" />',
+			'#value' => '<img src="'. $fileUrl . '?ts=' . time() .'"  id="cropbox" />',
 		);
 
 		$form['x1']=array(
