added autochecking of prefix when app enters the foreground