made main menu gimmick code more crash-safe