Fixed segfault issue and updated to limit sendfile() size