Added check for invalid ID when publishing story