Fixed code to run on Linux