Updated for mavericks compatibility