Better errors into dev

Pushing @marcello3d 's changes into dev as well.