Loopbugfixes

> Can't merge this one. Could you sync up the latest and send another pull request? 

Better now?