fixed compilation for linux
free allocated memory
tuned parameters