Fixes for stm32f4

This is to close #81 and hopefully #66.