fix handling files without extension
add assertion for directory listing bounds