Add script for debug mode configuration
Fix buffer file io read bugs