fixed some issues with how bos writes to the file