Added bug handling