Fixed bugs in the file detection and http handler subroutines.