Fixes multiple issues caused by a crappy algorithm in FileWrapper. fix #33 fix #34