fix undefined M_PI
fix typo
create dirs on building