remove unused DLLNAME variable
move errors to where they actually happen