Added rescue code fix from Ali Parsai