Edited code for some files based on testing with statically linked binaries