added unlink and buffer return