Added null and trivial checks to RMSUtils.write()
Added debug line for emulator testing