Fixed small bug in automated script