Slight modification to prevent from crashing when creating new database
item and to avoid genrating new thumbnail each time