diff --git a/compile_fw b/compile_fw
index 02261c75af46f0d24bd67f4db467ba1b5f295166..b6a6a456d7c9b50c2ccec2456454034de3b17e0d 100755
--- a/compile_fw
+++ b/compile_fw
@@ -49,7 +49,13 @@ _die() {
 	exit 1
 }
 
+if [ "$BUILD_DIR" == "$SRCDIR" ]; then
+	_die "You should run this script from build directory\nIt will delete content of current working directory!"
+fi
+
 _get_version() {
+	# If first grep fails - version is not first non-empty, add 999 to the end
+	# Be aware that Condition in if also outputs the results
 	if ! grep . "${SRC_DIR}"/NEWS | head -n 1 | grep '^[0-9.]\+$'; then
 		echo "$(grep '^[0-9.]\+$' "${SRC_DIR}"/NEWS | head -n 1).999"
 	fi