modified for GCC compatibility