diff --git a/dotfiles/ros.bash b/dotfiles/ros.bash
index 7e25f21b41c78d4a9d81c5f64054cf0c8651f8ac..40ee5e53a7ec99b9e9e60dd87735dfb268729422 100644
--- a/dotfiles/ros.bash
+++ b/dotfiles/ros.bash
@@ -25,15 +25,15 @@ function sourcews(){
 
 # Source the current workspace
 function sourcethis(){
+    pwd_bck=${PWD}
     roshome && source ./devel/setup.${ext} && smon
+    cd ${pwd_bck}
 }
 
 # Automatic catkin build
 function cb() {
-    pwd_bck=${PWD}
     catkin build --summarize "$@"
-    sourcethis()
-    cd ${pwd_bck}
+    sourcethis
 }
 
 # Clean workspace (delete the generated folders, then catkin build)