diff --git a/i3lock-custom b/i3lock-custom
index ff40f23..c99e65c 100755
--- a/i3lock-custom
+++ b/i3lock-custom
@@ -56,7 +56,7 @@ step_produce_image() {
 	# Really wanna make damn sure that we handle this well
 	set +e
 	umask 077
-	cd "$tmpdir"
+	cd "$tmpdir" || exit
 	# Grab a screenshot and perform some calculations to make our black bar
 	import -window root scrot.bmp
 	lockimg_gz | base64 -d | gunzip > lock.png
@@ -82,7 +82,7 @@ step_start_i3lock() {
 step_start_conky() {
 	i=0
 	while ! xprop -name "i3lock" > /dev/null 2>&1; do
-		i=$(( $i + 1 ))
+		i=$(( i + 1 ))
 		if [ "$i" -eq "100" ]; then
 			return 1
 		fi
@@ -105,5 +105,5 @@ main() {
 	step_wait
 }
 
-main $@
+main "$@"