Fix cat buffer issues

Fix for the current issues in cat.