fix incorrect LDFLAGS usage
fix for gcc linking order problems