Fixed file_writer so it works faster and bugless