updating with fs logic and fixing broken server code