writing bug finally fixed