Proper IO handling with padding and fixes