updated for better compatibility