Bug Fix

Several bugs fixed and migrated from API 8 to API 18