fixed a bug with backgrounding