some fixes: works on Arduino Mega now