Bunch of bug fixes for not being compliant with the API.