fixed some bugs

new attempt and platform detection