Fixed a fatal error when deleting Media that was attached to a post, cleaned up warnings