Compatibility Fixes for API 15/16

All the explanation is stated in the extended commit message.