debugging the "Cannot write .." issue