Fix bug where bg was used instead of fg

Also remove a duplicate line