some fixes and changes, too lazy to spererate them in multiple commits :P