add missing functions for linux and some cleanup